#include <stdio.h>
#include "paint.h"
#include "board.h"
#include "computer.h"
#include "mouse.h"

int main(int argc, char *argv[])
{
	int r, c, w;

	open_fb();
	show_board();
	open_mouse();

	while (1)
	{
		if ((w = step % 2 + 1) == argc)
		{
			if (computer_input(&r, &c, w))
			{
				show_piece(r, c, w);

				if (is_win(r, c))
					break;
			}
		}
		else
		{
			if (mouse_input(&r, &c, w))
			{
				show_piece(r, c, w);

				if (is_win(r, c))
					break;
			}
		}
		read_mouse();
	}

	close_mouse();
	close_fb();

	return 0;
}
